/**
 * Class TitleBar
 * This class manipulate the html used for title
 * Example:
 * //html for title
 * //<div id="title-id" class="title-bar">
 * //   <div class="button-holder">
 * //       <div class="button">
 * //       <span></span>
 * //       </div>
 * //   </div>
 * //   <div class="text-holder">
 * //       <h1></h1>
 * //   </div>
 * //   <div class="button-holder">
 * //       <div class="button">
 * //       <span></span>
 * //       </div>
 * //   </div>
 * //</div>
 * var title = new TitleBar("title-id");
 * title.setText("Title");
 * title.buttons -> array of Button
 */
TitleBar = (function(_super) {

    __extends(TitleBar, _super);
    /**
     * TitleBar constructor
     * @param view {String|View|HTMLElement} id, view or html element
     * @constructor
     */
    function TitleBar(view) {
        var button, _i, _len, _ref;
        TitleBar.__super__.constructor.call(this);
        this.setContentView(view);
        this._text = this.view.select("h1");
        this._buttons = this.view.selectAll(".button-holder", true);
        this.buttons = [];
        _ref = this._buttons;
        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
            button = _ref[_i];
            this.buttons.push(new Button(button));
        }
    }
    /**
     * Set title text
     * @param text {String} title text
     */
    TitleBar.prototype.setText = function(text) {
        if (!text) return;
        this._text.html(this.text = text);
    };

    return TitleBar;

})(Base);
